﻿// 1.1.6.03. Write a program that reads from the console a sequence of N integer numbers and
// returns the minimal and maximal of them.

using System;

class MinAndMaxOfSequence
{
    static void Main()
    {
        int userInput = int.Parse(Console.ReadLine());
        int maxValue = int.MinValue;
        int minValue = int.MaxValue;
        int[] userInputSequence = new int[userInput];   // declaring array with userInput in number elements
        for (int i = 0; i < userInput; i++)             // filling the array with user's input elements
        {
            userInputSequence[i] = int.Parse(Console.ReadLine());
        }

        for (int i = 0; i < userInputSequence.Length; i++)
        {
            if (userInputSequence[i] > maxValue)
            {
                maxValue = userInputSequence[i];
            }
            if (userInputSequence[i] < minValue)
            {
                minValue = userInputSequence[i];
            }
        }
        Console.WriteLine(minValue);
        Console.WriteLine(maxValue);
    }
}
